#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <utility>
#include "./http.h"


int HttpReqMsg::append(const void *buf, size_t size)
{
    req.parse_request((char*)buf,size);

	return 1;//0 :all bytes handlered
}
Http::Router HttpRepMsg::router;
int HttpRepMsg::encode(struct iovec vectors[], int max)
{
vectors[0]=reply.startline_buf;
reply.startline_buf.iov_base=nullptr;
vectors[1]=reply.head_buf;
reply.head_buf.iov_base=nullptr;

int cnt=reply.content_buf.size();
if(cnt>0)
    memcpy(&vectors[2],reply.content_buf.data(),cnt*sizeof(struct iovec));
reply.content_buf.resize(0);
	return cnt+2;//number of string block
}

